getPhysicsPolygonCollider = () => {
    var prefabIndex = 0;
    for (var i = 0; i < global.UnityNode.length; i++) {
        var d = global.UnityNode[i];
        for (var j = 0; j < d.PhysicsPolygonCollider.length; j++) {
          if (d.PhysicsPolygonCollider[j].Add) {
              var nodeId = d.ID;
              prefabIndex++;
              global.curID++;
              global.finialInfo.push(PhysicsPolygonCollider(nodeId,d.PhysicsPolygonCollider[j]));
          }
        }
    }
}
PhysicsPolygonCollider = (nodeId,data) => {
  var newPoints = [];
    for(var i = 0;i<data.Points.length;i++) {
        newPoints.push({
          "__type__": "cc.Vec2",
          "x":Number(data.Points[i].x.toFixed(2)),
          "y":Number(data.Points[i].y.toFixed(2)),
        })
    }
    var d = {
        "__type__": "cc.PhysicsPolygonCollider",
        "_name": "",
        "_objFlags": 0,
        "node": {
          "__id__": nodeId
        },
        "_enabled": true,
        "tag": data.Tag,
        "_density": data.Density,
        "_sensor": false,
        "_friction": Number(data.Friction.toFixed(2)),
        "_restitution": 0,
        "body": null,
        "_offset": {
          "__type__": "cc.Vec2",
          "x": Number(data.OffSet.x.toFixed(2)),
          "y": Number(data.OffSet.y.toFixed(2))
        },
        "points":  newPoints,
        "_id": ""
    }
    if (global.isShowId) d["ID"] = global.curID;
    return d;
}
module.exports = {
    getPhysicsPolygonCollider,
};